﻿
Imports System.Threading
Imports osi.root.delegates

Public Module _threadpool
    Public Sub k_queue_in_managed_threadpool(ByVal d As WaitCallback)
        k_assert(Not d Is Nothing)
        k_assert(ThreadPool.QueueUserWorkItem(d))
    End Sub

    Public Sub k_queue_in_managed_threadpool(ByVal d As WaitCallback, ByVal o As Object)
        k_assert(Not d Is Nothing)
        k_assert(ThreadPool.QueueUserWorkItem(d, o))
    End Sub

    Public Sub k_queue_in_managed_threadpool(ByVal d As void)
        k_assert(Not d Is Nothing)
        k_assert(ThreadPool.QueueUserWorkItem(Sub() d()))
    End Sub

    Public Sub k_queue_in_managed_threadpool(Of T)(ByVal d As void(Of T), ByVal i As T)
        k_assert(Not d Is Nothing)
        k_assert(ThreadPool.QueueUserWorkItem(Sub() d(i)))
    End Sub

    Public Sub k_queue_in_managed_threadpool(Of T)(ByVal d As Action(Of T), ByVal i As T)
        k_assert(Not d Is Nothing)
        k_assert(ThreadPool.QueueUserWorkItem(Sub() d(i)))
    End Sub
End Module
